<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form" lay-filter="test1">
    <input type="hidden" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label required">公司编号：</label>
        <div class="layui-input-block">
            <input type="text" name="companyNo" lay-verify="required" lay-reqtext="公司编号不能为空" placeholder="请输入公司编号" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">公司名称：</label>
        <div class="layui-input-block">
            <input type="text" name="companyName" lay-verify="required" lay-reqtext="公司名称不能为空" placeholder="请输入公司名称" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">责任人：</label>
        <div class="layui-input-block">
            <input type="text" name="personCharge" lay-verify="required" lay-reqtext="责任人不能为空" placeholder="请输入责任人" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">公司地址：</label>
        <div class="layui-input-block">
            <input type="text" name="address" lay-verify="required" lay-reqtext="公司地址不能为空" placeholder="请输入公司地址" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮政编号：</label>
        <div class="layui-input-block">
            <input type="text" name="postcode" lay-verify="required" lay-reqtext="邮政编号不能为空" placeholder="请输入邮政编号" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">法人代表：</label>
        <div class="layui-input-block">
            <input type="text" name="corporator" lay-verify="required" lay-reqtext="法人代表不能为空" placeholder="请输入法人代表" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系电话：</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="required" lay-reqtext="联系电话不能为空" placeholder="请输入联系电话" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">公司资质：</label>
        <div class="layui-input-block">
            <input type="text" name="qualification" lay-verify="required" lay-reqtext="公司资质不能为空" placeholder="请输入公司资质" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">修改物业公司信息</button>
        </div>
    </div>
</div>
<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    //获取要修改的对象
    var obj=JSON.parse(localStorage.getItem("company"));
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;
        //为表单赋值
        form.val("test1",obj);
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            //修改物业公司信息 Ajax 请求接口
            $.post('/api/company/update.do', data.field, function (res) {
                if (res.code == 0) {
                    location.href="companytable.html"
                    //成功
                    // 关闭弹出层
                    var iframeIndex = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(iframeIndex);
                } else {
                    layer.msg("亲。修改失败！");
                }
            })
            return false;
        });
    });
</script>
</body>
</html>